home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / swbprint / testmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-06  |  4.2 KB  |  117 lines

  1. VERSION 5.00
  2. Begin VB.Form MainForm 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Sample SWBPrinter Application"
  5.    ClientHeight    =   4170
  6.    ClientLeft      =   45
  7.    ClientTop       =   360
  8.    ClientWidth     =   5940
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   4170
  13.    ScaleWidth      =   5940
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.CheckBox chkSizable 
  17.       Caption         =   "Preview in &Sizable Window"
  18.       Height          =   240
  19.       Left            =   3420
  20.       TabIndex        =   3
  21.       Top             =   3780
  22.       Width           =   2355
  23.    End
  24.    Begin VB.TextBox Memo 
  25.       Height          =   2775
  26.       Left            =   180
  27.       Locked          =   -1  'True
  28.       MultiLine       =   -1  'True
  29.       ScrollBars      =   2  'Vertical
  30.       TabIndex        =   1
  31.       Text            =   "testmain.frx":0000
  32.       Top             =   840
  33.       Width           =   5535
  34.    End
  35.    Begin VB.CommandButton PrevBtn 
  36.       Caption         =   "&Preview"
  37.       Height          =   435
  38.       Left            =   4500
  39.       TabIndex        =   0
  40.       Top             =   180
  41.       Width           =   1275
  42.    End
  43.    Begin VB.Label Label1 
  44.       BackStyle       =   0  'Transparent
  45.       Caption         =   "Sample Memo Text:"
  46.       Height          =   195
  47.       Left            =   180
  48.       TabIndex        =   2
  49.       Top             =   600
  50.       Width           =   1875
  51.    End
  52. Attribute VB_Name = "MainForm"
  53. Attribute VB_GlobalNameSpace = False
  54. Attribute VB_Creatable = False
  55. Attribute VB_PredeclaredId = True
  56. Attribute VB_Exposed = False
  57. 'SWBPrinter Sample Application
  58. 'Copyright 1998 Software with Brains, Inc.
  59. 'All rights reserved.
  60. Option Explicit
  61. Private Const SWBPRINTER_FONT_BOLD = 1
  62. Private Const SWBPRINTER_FONT_UNDERLINE = 2
  63. Private Const SWBPRINTER_FONT_ITALIC = 4
  64. Private WithEvents SWBPrintEngine As SWBPrinter
  65. Attribute SWBPrintEngine.VB_VarHelpID = -1
  66. Private Sub Form_Load()
  67.     Set SWBPrintEngine = New SWBPrinter
  68. End Sub
  69. Private Sub Form_Unload(Cancel As Integer)
  70.     If Not SWBPrintEngine.SaveReport("") Then MsgBox ("You chose not to save the current report.")
  71.     SWBPrintEngine.DestroyReport
  72. End Sub
  73. Private Sub PrevBtn_Click()
  74.     Dim I As Integer
  75.     SWBPrintEngine.BeginDoc
  76.     SWBPrintEngine.ScaleMode = vbInches
  77.     SWBPrintEngine.Orientation = vbPRORPortrait
  78.     SWBPrintEngine.Spacing = 1.2
  79.     SWBPrintEngine.AutoHeadings = True
  80.     SWBPrintEngine.AutoNewPage = True
  81.     SWBPrintEngine.ShowProgress = True
  82.     SWBPrintEngine.AutoHeadingsFontName = "Arial"
  83.     SWBPrintEngine.AutoHeadingsFontSize = 12
  84.     SWBPrintEngine.AutoHeadingsFontAttr = SWBPRINTER_FONT_ITALIC Or SWBPRINTER_FONT_BOLD
  85.     SWBPrintEngine.Title = "Sample SWBPrinter Report"
  86.         
  87.     SWBPrintEngine.SetFont "Arial", 10, 0
  88.         
  89.     SWBPrintEngine.Y = 2
  90.     For I = 1 To 20
  91.         SWBPrintEngine.TextOut 0.5, "The quick brown fox jumped over the lazy dog.  Y position = " & SWBPrintEngine.Y & "   Line # " & I
  92.         SWBPrintEngine.NewLine
  93.     Next I
  94.     SWBPrintEngine.SetFont "Times New Roman", 10, SWBPRINTER_FONT_ITALIC
  95.     SWBPrintEngine.Y = SWBPrintEngine.Y + 0.25
  96.     For I = 1 To 20
  97.         SWBPrintEngine.TextOut 0.5, "The quick brown fox jumped over the lazy dog.  Y position = " & SWBPrintEngine.Y & "   Line # " & I
  98.         SWBPrintEngine.NewLine
  99.     Next I
  100.     SWBPrintEngine.NewPage
  101.     SWBPrintEngine.BoxOut 2.5, 2.75, 7, 9
  102.     SWBPrintEngine.Y = 3
  103.     SWBPrintEngine.MemoOut 2.75, 6.75, Memo.Text
  104.     SWBPrintEngine.NewPage
  105.     SWBPrintEngine.BoxOut 2, 3, 7, 4.25
  106.     SWBPrintEngine.ImageOut App.Path & "\swbtitle.jpg", 2.1, 3.1, 4.8, 1
  107.     SWBPrintEngine.Y = 4.5
  108.     SWBPrintEngine.SetFont "Arial", 16, SWBPRINTER_FONT_BOLD
  109.     SWBPrintEngine.TextOut 3, "Sample Image Output"
  110.     SWBPrintEngine.EndDoc
  111.     SWBPrintEngine.PreviewSizable = (chkSizable.Value = vbChecked)
  112.     SWBPrintEngine.PreviewReport
  113. End Sub
  114. Public Sub SWBPrintEngine_OnNewPage(ByVal PageNum As Integer)
  115.     SWBPrintEngine.Y = 2
  116. End Sub
  117.